document.addEventListener('DOMContentLoaded', () => {
    const loginForm = document.getElementById('loginForm');
    const errorMessage = document.getElementById('errorMessage');

    loginForm.addEventListener('submit', () => {
        const username = document.getElementById('username').value;
        const password = document.getElementById('password').value;

        if (username === 'admin' && password === 'admin') {
            // 登录成功，存储登录状态
            localStorage.setItem('isLoggedIn', 'true');
            // 跳转到聊天页面
            window.location.href = 'ai-chat.html';
        } else {
            errorMessage.textContent = '用户名或密码错误';
        }
    });
}); 